import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: lenovo
 * Date: 2022-07-12
 * Time: 8:56
 */
public class Test {
    public static int sqrt (int x) {
        // write code here
        if(x==1){
            return 1;
        }
        int left = 1;
        int right = x;
        while(right>=left){
            int mid = (right+left)/2;
            if(mid*mid<=x&&(mid+1)*(mid+1)>x){
                return mid;
            }else if(mid*mid>x){
                right = mid - 1;
            }else{
                left = mid+1;
            }
        }
        return 0;

    }


        public static void main7(String[] args) {
        //String
            long start = System.currentTimeMillis();
            String s = "";
            for(int i = 0; i < 10000; ++i){
                s += i;
            }
            long end = System.currentTimeMillis();
            System.out.println(end - start);//282
            //StringBuffer
            start = System.currentTimeMillis();
            StringBuffer sbf = new StringBuffer("");
            for(int i = 0; i < 10000; ++i){
                sbf.append(i);
            }
            end = System.currentTimeMillis();
            System.out.println(end - start);//1
            //StringBuilder
            start = System.currentTimeMillis();
            StringBuilder sbd = new StringBuilder();
            for(int i = 0; i < 10000; ++i){
                sbd.append(i);
            }
            end = System.currentTimeMillis();
            System.out.println(end - start);//1
    }
    public static void main(String[] args) {
//        String s1 = "hello";
//        s1+=" world";
//        System.out.println(s1);
        StringBuilder s1 = new StringBuilder();
        s1.append("hello");
        s1.append("world");
        String s = s1.toString();
        System.out.println(s);
//        StringBuffer s1 = new StringBuffer();
//        s1.append("hello");
//        s1.append("world");
//        String s = s1.toString();
//        System.out.println(s);
//        System.out.println(s1);
//        s1.reverse();
//        System.out.println(s1);
    }
    public static void main4(String[] args) {
        final char[] value = {'a','b','c'};
       //value = new char[10];
        value[0] = 'A';
    }
    public static void main3(String[] args) {
        char[] chars = {'a','b','c'};
        String s1 = new String(chars);
        s1.intern();
        String s2 = "abc";
        System.out.println(s1==s2);// true
    }
    public static void main2(String[] args) {
        int i = -5;
        //i = ++(i++);
        System.out.println(i);
    }
    public static void main1(String[] args) {

        Scanner scanner = new Scanner(System.in);

        int x = scanner.nextInt();
        System.out.println(Math.sqrt(x));
        int ret = sqrt(x);
        System.out.println(ret);
    }
}
